<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.css">
    <link rel="shortcut icon" href="//cube.elemecdn.com/c/54/38fa90be5da041bbec3945fb82c00png.png">
    <link href="framework/reset.css" rel="stylesheet">
    <link href="framework/icon.css" rel="stylesheet">
    <link href="css/myInfo.css" rel="stylesheet">
    <script src="https://fastly.jsdelivr.net/npm/vue@2.7.14/dist/vue.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <script src="js/pageJump.js"></script>
    <title>我的界面</title>
</head>
<body>
    <div class="wrapper" id="app">
        <header>
            <p>我的界面</p>
        </header>
        <div class="content-wrapper">
            
            <div class="header">
                <img :src="userInfo.userImg!=null?userInfo.Img:'https://p5.itc.cn/images01/20230828/318b2f2dd401486baf1c4421f9d9d30d.jpeg'" alt="">
                <p>{{userInfo.userName+' '+(userInfo.userSex==0?"先生":"女士")}}</p>
            </div>
            
            <ul class="choice">
                <li class="content" @click="jumpTo('userAddress.html')" >
                    <div class="fa fa-id-card-o"></div>
                    <p>
                        送货地址
                    </p>
                </li>
                <li class="vertical"></li>
                <li class="content">
                    <div class="fa fa-diamond" @click="jumpTo('pointsList.html')"></div>
                    <p>
                        我的积分
                    </p>
                </li>
            </ul>
           
        </div>
        
        <ul class="footer" id="footer">
            
            <li onclick="location.href='index.html'">
                <i class="fa fa-home"></i>
                <p>首页</p>
            </li>
            <li>
                <i class="fa fa-compass"></i>
                <p>发现</p>
            </li>
            <li onclick="location.href='orderList.html'">
                <i class="fa fa-file-text-o"></i>
                <p>订单</p>
            </li>
            <li>
                <i class="fa fa-user-o"></i>
                <p>我的</p>
            </li>
        </ul>
    </div>
    <script>
        var path=getRequestPath()
        var app=new Vue({
            el:"#app",
            data:{
                userInfo:{}
            },
            methods:{
                getUser:async function(){
                    axios.post(path+"/UserController/getUserById",null,{
                        params:{},
                        headers:{ Authorization:this.getAuthorization() }
                    }).then((respon)=>{
                        if(respon.data.code==200){           
                            this.userInfo=respon.data.detail
                        }else if(respon.data.code==400&&respon.data.detail.errorCode==401){
                            jumpToLogin()
                        }
                    }).catch((error)=>{
                        console.log(error)
                    })
                },
                getAuthorization:()=>{
                    return window.localStorage.getItem("Auth")
                },
                jumpTo:function(u){
                    window.location.href=u
                },
            },
            created(){
                this.getUser()
            }
        })
    </script>
</body>
</html>